<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>U Say - {$data['title']}</title>

    <!-- Bootstrap -->
    <link href="{$CSS_PATH}bootstrap.min.css" rel="stylesheet">

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <!-- 百度编辑器引用文件 -->
    <link href="/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
    <!-- <script type="text/javascript" src="/umeditor/third-party/jquery.min.js"></script> -->
    <script type="text/javascript" src="/umeditor/third-party/template.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/umeditor/umeditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/umeditor/umeditor.min.js"></script>
    <script type="text/javascript" src="/umeditor/lang/zh-cn/zh-cn.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style type="text/css">
      .hiddens {
        height: 100px; 
        overflow:hidden; 
        text-overflow:ellipsis; 
        display:-webkit-box; 
        -webkit-box-orient:vertical; 
        -webkit-line-clamp:4; 
      }
      img {
        max-width: 100%
      }
    </style>
  </head>
  <body style="background: #f3f3f3;">
    <!-- 侧边导航条 -->
    <nav class="navbar navbar-default" style="position: fixed; width: 10%;top:32%;text-align: center; background: #DEDEDE; box-shadow: 0 0 3px 2px #ccc;" >
      <div class="container-fluid">
        
                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                  <ul class="nav navbar-nav">
                    <li><a href="{:url('index/index/index')}">&emsp;&emsp;首页 </a></li>
                    <li><a href="{:url('index/question/index')}">&emsp;问题广场</a></li>
                    <li class="dropdown">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">&emsp;分类导航<span class="caret"></span>&emsp;</a>
                      <ul class="dropdown-menu" style="min-width: 198px;text-align: center;background: rgba(62, 49, 68, 0.2);left: -37px;top: 55px;box-shadow: 0 0 3px 2px #ccc;border-radius: 6px;">
                        <li><a href="#">我的收藏</a></li>
                        <li><a href="#">我的提问</a></li>
                        <li><a href="#">我的回答</a></li>
                      </ul>
                    </li>
                  </ul>
                </div><!-- /.navbar-collapse -->
        
      </div><!-- /.container-fluid -->
    </nav>
    <!-- 顶部导航条 -->
    <nav class="navbar navbar-default" style="margin:0;padding: 12px 0;border-bottom: 1px solid rgba(30,35,42,.12); background-color: #fff;box-shadow: 0 1px 3px 0 rgba(0,34,77,.08);">
        <div class="col-md-2"></div>
        <div class="col-md-8">
              <div class="container-fluid">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                  <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                  </button>
                  <a class="navbar-brand" href="#">U Say</a>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                  <ul class="nav navbar-nav">
                    <!-- <li class="active"><a href="{:url('index/index/index')}">首页 <span class="sr-only">(current)</span></a></li> -->
                    <li><a href="{:url('index/question/index')}">问题广场</a></li>
                    <li class="dropdown">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">分类 <span class="caret"></span></a>
                      <ul class="dropdown-menu">
                        <li><a href="#">Action</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">Separated link</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">One more separated link</a></li>
                      </ul>
                    </li>
                  </ul>
                  <form class="navbar-form navbar-left">
                    <div class="form-group">
                      <input type="text" class="form-control" placeholder="有问题？" style="width:500px;" id="search-input">
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                  </form>
                  <ul class="nav navbar-nav navbar-right">
                    <!-- 登录 -->
                    <!-- <form class="form-inline">
                      <div class="form-group">
                        <label class="sr-only" for="exampleInputEmail3">Email address</label>
                        <input type="email" class="form-control" id="exampleInputEmail3" placeholder="Email">
                      </div>
                      <div class="form-group"">
                        <label class="sr-only" for="exampleInputPassword3">Password</label>
                        <input type="password" class="form-control" id="exampleInputPassword3" placeholder="Password"  style="width: 100px;>
                      </div>
                      <div class="checkbox">
                        <label>
                          <input type="checkbox" name="">记住我
                        </label>
                      </div>
                      <button type="submit" class="btn btn-default">登录</button>
                    </form> -->
                    <!-- 结束登录 -->
                    <li><a href="#" class="btn active" role="button" style=" padding: 8px; margin: 7px; color: #fff; background: #2F2567;">登录/注册</a></li>
                    <li class="dropdown">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">用户<span class="caret"></span></a>
                      <ul class="dropdown-menu">
                        <li><a href="#">我的收藏</a></li>
                        <li><a href="#">我的提问</a></li>
                        <li><a href="#">我的回答</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">退出登录</a></li>
                      </ul>
                    </li>
                  </ul>
                </div><!-- /.navbar-collapse -->
              </div><!-- /.container-fluid -->
        </div>
        <div class="col-md-2"></div>
    </nav>

    <!-- 问题部分 -->
    <div style="background-color: #fff;">
    <div class="container" style="margin-bottom:16px;padding-bottom: 12px;">
      <div class="row">
        <div class="col-md-8">
          <h3 style="font-weight: 600; font-family: 微软雅黑;">
            {$data['title']}
          </h3>
          <!--  class="hiddens" 以...显示多行，此功能不兼容IE -->
          <p style="line-height: 25px; ">
                 {$data['content']}

          </p>
          <a style="display: none;text-align: right; color: #175199;font-size: 12px;" class="showContent">
            展开全部
            <svg viewBox="0 0 10 6" class="Icon ContentItem-arrowIcon Icon--arrow" width="10" height="16" aria-hidden="true" style="height: 10px; width: 16px;"><title></title><g><path d="M8.716.217L5.002 4 1.285.218C.99-.072.514-.072.22.218c-.294.29-.294.76 0 1.052l4.25 4.512c.292.29.77.29 1.063 0L9.78 1.27c.293-.29.293-.76 0-1.052-.295-.29-.77-.29-1.063 0z"></path></g></svg>
          </a>
          <button type="button" class="btn" style="margin-left:8px;background-color: #0d79d1; color: #fff;">我来解答</button>
          <span color="#8590a6">10条评论&emsp;&emsp;
            <button type="button" class="btn btn-info">分享</button>&emsp;
            <button type="button" class="btn btn-warning">私信</button>
          </span>
        </div>
        <div class="col-md-4">
          <button type="button" class="btn btn-lg" style="margin:45px 60px;background-color: #0d79d1; color: #fff;">收藏此问题</button>
        </div>
      </div>
      <!-- <div class="row">
        <div class="col-md-8">.col-md-8</div>
        <div class="col-md-4">.col-md-4</div>
      </div> -->
    </div>
    </div>
    <!-- 答案部分 -->
    <div class="container">
      <div class="row">
        <!-- 左侧答案 -->
        <div class="col-md-8" style="background: #fff; padding: 15px;">
          {volist name="answer" id="a"}
          <!-- 面板即为一个答案 -->
          <div class="panel panel-default">
            <!-- 面板标题：回答者信息 -->
            <div class="panel-heading" style="overflow: hidden;">
              {$a['name']}
              <div style="display: inline-block;float: right;">1024人赞同该回答</div>
            </div>
            <!-- 回答内容 -->
            <div class="panel-body" style="padding-bottom: 16px;">
              <p>{$a['content']}</p>
              <!-- 回复展示框体 -->   
              <div>
                {volist name="replys[$a['aid']]" id="r"}
                <!-- 1 -->   
                <div class="panel panel-default" style="margin-bottom: 3px">
                  <div class="panel-body" style="margin-bottom:1px;background-color: #eee;">
                  {$r['name']}： {$r['content']}
                  <span style="float: right;">{$r['time']}</span>
                  </div> 
                </div> 
                <!-- 1 END -->
                {/volist}
              </div>
              <!-- 附加操作 点赞等 -->
              <div>
                
              </div>
            </div>
          </div>
          <!-- 单回答面板结束 -->
          {/volist}

          <form style="margin-top:16px;">
              <!--style给定宽度可以影响编辑器的最终宽度-->
              <script type="text/plain" id="myEditor" style="width:100%;height:240px;">
                  <p>想说点什么呢？</p>
              </script>
              <div class="clear"></div>
              <button type="button" class="btn btn-lg reply-botton" style="display: block; margin:16px auto;background-color: #0d79d1; color: #fff;" url="{:url('index/question/reply')}" qid="{$data['id']}" motion="answer">发表回答</button>
          </form>
        </div>
        <!-- 右侧推广 -->
        <div class="col-md-4">
          <div style="background-color: #fff;">
            这边是推广
          </div>
        </div>
      </div>
    </div>


    <h1>你好，世界！</h1>


    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="{$JS_PATH}bootstrap.min.js"></script>

    <script type="text/javascript">
      // 判断内容溢出
      $('.showContent').prev("p").each(function (i){
        if($(this).height() > 100){
          $(this).next('.showContent').css('display','block');
          $(this).addClass('hiddens');
        } 
      });
      // 展示问题内容
      $('.showContent').click(function(){
          $(this).prev("p").removeClass('hiddens');
          $(this).css('display','none');
        }
      );
    </script>
    <!-- 百度编辑器JS -->
    <script type="text/javascript">
      //实例化编辑器
      var um = UM.getEditor('myEditor');
      function getContent() {
          var arr = [];
          arr.push("使用editor.getContent()方法可以获得编辑器的内容");
          arr.push("内容为：");
          arr.push(UM.getEditor('myEditor').getContent());
          alert(arr.join("\n"));
      }
      $('.reply-botton').click(function (){
            var cont = UM.getEditor('myEditor').getContent();
            $.ajax({
                type: 'post',
                data: {
                        "content": cont,
                        "qid":$(this).attr('qid'),
                        "aid":$(this).attr('aid'),
                        "motion":$(this).attr('motion')
                      },
                url: $(this).attr('url'),
                success: function (data) {
                        console.log(data);
                        if (data != 1) {
                          alert('回复失败！');
                          return;
                        }
                        location = location;
                },
                error: function () {
                    alert('执行失败，请重试');
                }
            });
      });
  </script>

  </body>
</html>